<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>完成设备安检</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="__HOME_CSS__/font.css">
        <link rel="stylesheet" href="__HOME_CSS__/xadmin.css">
        <script src="__HOME_JS__/echarts.min.js"></script>
        <script src="__HOME_LIB__/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="__HOME_JS__/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="__HOME_JS__/html5.min.js"></script>
            <script src="__HOME_JS__/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                    <div class=layui-form-item>
                        <label class=layui-form-label for=L_warning_time><span class=x-red>*</span>预警时间</label>
                        <div class=layui-input-inline>
                            <input class=layui-input id=L_warning_time autocomplete="off" name=warning_time placeholder=预警时间>
                        </div>
                    </div>
                    <div class=layui-form-item>
                        <label class=layui-form-label for=L_check_time><span class=x-red>*</span>检修时间</label>
                        <div class=layui-input-inline>
                            <input class=layui-input id=L_check_time autocomplete="off" name=check_time placeholder=检修时间>
                        </div>
                    </div>
                    <div class=layui-form-item>
                        <label class=layui-form-label for=L_scrap_time><span class=x-red>*</span>报废时间</label>
                        <div class=layui-input-inline>
                            <input class=layui-input id=L_scrap_time autocomplete="off" name=scrap_time placeholder=报废时间>
                        </div>
                    </div>
                    <div class=layui-form-item><label class=layui-form-label for=L_repass></label>
                        <button class=layui-btn lay-filter=add lay-submit="">确定完成安检</button>
                    </div>
                </form>
            </div>
        </div>
        <script>layui.use(['form', 'layer','jquery','laydate'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;

                //监听提交
                form.on('submit(add)',
                function(data) {
                    var check_time = data.field.check_time;
                    var warning_time = data.field.warning_time;
                    var scrap_time = data.field.scrap_time;
                    $.ajax({
                        type: 'post',
                        url: "{:url('index/securitycheck/finishcheck')}?id={$device_id}",
                        sync:false,
                        data: {
                            check_time: check_time,
                            warning_time: warning_time,
                            scrap_time: scrap_time
                        },
                        success: function (res) {
                            if (res.code === 0) {
                                layer.msg(res.msg, {
                                        icon: 6
                                    },
                                    function () {
                                        xadmin.close();
                                        xadmin.father_reload();
                                    });

                            } else {
                                layer.msg(res.msg)
                            }
                        }
                    });
                    return false;
                });

                var laydate = layui.laydate;

                //执行一个laydate实例
                laydate.render({
                    elem: '#L_scrap_time' //指定元素
                });

                //执行一个laydate实例
                laydate.render({
                    elem: '#L_check_time' //指定元素
                });
                //执行一个laydate实例
                laydate.render({
                    elem: '#L_warning_time' //指定元素
                });
            });</script>
    </body>

</html>